<template>
	<view>
		<view class="content">
			<view class="one-infor">
				<view>修改綁定手機號</view>
				<image class="open" src="../../../static/image/mine/open.png" mode=""></image>
			</view>
			<view class="one-infor" @click="toChange">
				<view>修改登錄密碼</view>
				<image class="open" src="../../../static/image/mine/open.png" mode=""></image>
			</view>
			<view class="one-infor">
				<view>設置緊急聯繫人</view>
				<image class="open" src="../../../static/image/mine/open.png" mode=""></image>
			</view>
			<view class="one-infor">
				<view>實名認證</view>
				<image class="open" src="../../../static/image/mine/open.png" mode=""></image>
			</view>
			<view class="one-infor">
				<view>銀行卡設置</view>
				<image class="open" src="../../../static/image/mine/open.png" mode=""></image>
			</view>
		</view>
		<view class="btn" @click="toLoginOut">
			退出登錄
		</view>
		<u-modal :show="showTips" @close="close" @confirm='loginOut' @cancel='close'  content='確定退出登錄？退出後將清除賬號信息' :showCancelButton='true' confirmColor='#D71B0A'></u-modal>
	</view>
</template>

<script>
	import {myLoginOut} from '../../../request/api.js'
	export default {
		data() {
			return {
				showTips:false
			};
		},
		methods:{
			toChange(){
				uni.navigateTo({
					url:'/pages/change-password/change-password'
				})
			},
			close(){
				this.showTips=false;
			},
			toLoginOut(){
				this.showTips=true;
			},
			async loginOut(){
				uni.showLoading({
					title:'註銷中...'
				})
				let res=await myLoginOut();
				console.log(res);
				uni.hideLoading();
				if(res.code==1){
					uni.clearStorageSync();
					this.$store.commit("user/CHANGE_MY_INFOR",'');
					this.$store.commit('user/CHANGE_LOGIN_STATUS',false);
					uni.navigateBack({
						delta: 2
					})
				}
			}
		}
	}
</script>

<style lang="scss">
	page{
		background-color: #FAFAFA;
		.content{
			width:702rpx;border-radius: 20rpx;
			box-shadow: 0rpx 2rpx 12rpx 0rpx rgba(204,204,204,0.3);
			background-color:#ffffff;box-sizing: border-box;
			padding:0 24rpx;margin-top:24rpx;margin-left:auto;
			margin-right:auto;
			.one-infor{
				height:90rpx;display: flex;align-items: center;font-size: 30rpx;
				color:#040404;
				justify-content: space-between;border-bottom:1px solid #F0F0F0;
				.open{
					width:13rpx;height:20rpx;
				}
			}
		}
		.btn{
			width:600rpx;height:98rpx;border-radius: 98rpx;
			display: flex;align-items: center;
			justify-content: center;font-size:30rpx;color:#Ffffff;
			background-color: #040404;margin-top:50rpx;
			margin-left:auto;margin-right:auto;
		}
	}
</style>
